﻿using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using DBUtility;
using IDAL;
using Model;

namespace DAL
{
    public class PCBAVItem : BaseRepository<PCBAVItemInfo>, IPCBAVItem
    {
        private const string PARM_ASSEMBLEDETAILS_PRODUCTSN = "@PCBASN";

        public IList<PCBAVItemInfo> GetPCBAVItembySN(string pCBASN)
        {
            SqlParameter parm = GetParameter();
            //Bind the parameter
            parm.Value = pCBASN;
            return ExcuteSqlToGetEntities("PCBAVItem_selectbySN", parm);
        }


        //-------------------------------------重写超类基础操作---------------------------------------------------------

        public override PCBAVItemInfo GetEntityRecord(SqlDataReader rdr)
        {
            PCBAVItemInfo pro = new PCBAVItemInfo(rdr.GetValue(0).ToString(),rdr.GetDateTime(1), rdr.GetValue(2).ToString(), rdr.GetDecimal(3));
            return pro;
        }

        public override SqlParameter GetParameter()
        {
            SqlParameter Parm = new SqlParameter(PARM_ASSEMBLEDETAILS_PRODUCTSN, SqlDbType.NVarChar, 50);
            return Parm;
        }
    }
}
